package com.jiazhong.Abstract.Demo01;

public class Demo01 {
    public static void main(String[] args) {
        AA aa=new AA();
        System.out.println(aa.job());
        BB bb=new BB();
        System.out.println(bb.job());
    }
}

class AA {//计算1+2+...+100000的时间

    public long job() {
        int sum = 0;
        long stat = System.currentTimeMillis();
        for (int i = 1; i <= 10000000; i++) {
            sum+=i;
        }
        long end=System.currentTimeMillis();
        return end-stat;
    }
}

class BB {
    public long job(){
        int mul=1;
        long star=System.currentTimeMillis();
        for (int i=1;i<=100000;i++){
            mul*=i;
        }
        long end=System.currentTimeMillis();
        return end-star;
    }
}
